package com.kuang.springCloud.service;

import com.kuang.springCloud.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

//Feign使用
@Component  //注入到spring中
@FeignClient(value = "SPRINGCLOUDPROVIDERDEPT",fallbackFactory = DeptClientServiceFallbackFactory.class) //value 是配置微服务的名称（就是application对应的名称） ;fallbackFactory 是配置服务降级的
public interface DeptClientService {
    @GetMapping("/dept/list")
    public List<Dept> queryAll();

    @GetMapping("/dept/get/{id}")
    public Dept queryById(@PathVariable("id") Long id);

    @PostMapping("/dept/add")
    public boolean add(Dept dept);
}
